import {
  TiandiMap_vec,
  TiandiMap_cav,
  TiandiMap_img,
  TiandiMap_cia,
  Zondy_docLayer,
  Gaode_vec,
  Gaode_img
} from './initMap'
import { useMapStore } from '@/stores/map.js'
import { storeToRefs } from 'pinia'
const { map } = storeToRefs(useMapStore())
export const useToggleMap = () => {
  const toggleVec = () => {
    map.value.getLayers().clear()
    map.value.addLayer(TiandiMap_vec)
    map.value.addLayer(TiandiMap_cav)
    // map.value.addLayer(Gaode_vec)
    map.value.addLayer(Zondy_docLayer)
  }
  const toggleImg = () => {
    map.value.getLayers().clear()
    map.value.addLayer(TiandiMap_img)
    map.value.addLayer(TiandiMap_cia)
    // map.value.addLayer(Gaode_img)
    map.value.addLayer(Zondy_docLayer)
  }
  return { toggleVec, toggleImg }
}
